<?php
/**
 * Ora  Plugin Loader
 *  @author lan7
 *  @copyright lan7.net
 *  @version 2.0
 */
class loader extends mod{
	function __construct(){
		parent::__construct();
	}

	/**
	 * 默认方法
	 *
	 */
	function index(){
		$pn = $GLOBALS['_param']["pn"];
		$md = $GLOBALS['_param']['md']?$GLOBALS['_param']['md']:'index';
		$pnObj = $this->db->getOne("select * from ".tn('plugin')." where p_code = '$pn' and p_status = 1");
		if($pnObj){
			try{
				/* 加载插件 */
				include(PLUGIN_PATH.$pnObj['p_code']."/index.php");
				$tmp = new $pn();
			}catch (Exception $e){
				$this->setTplDir(PUBLIC_PATH);
				$this->setMsgTpl("admin/msg.html");
				$this->showMsg("实例化插件对象失败!");
			}
			$tmp->$md();
		}else{
			$this->setTplDir(PUBLIC_PATH);
			$this->setMsgTpl("admin/msg.html");
			$this->showMsg("该页面不存在!");
		}
	}

}
?>